package Day07;
import java.util.Scanner;
public class Guessing {
    public static void main(String[] args) {
//        Scanner number1 = new Scanner(System.in);
//        int number2 = (int)(Math.random()*1000+1);
//        System.out.println(number2);
//        System.out.print("猜吧：");
//        int guess = number1.nextInt();
//        while (guess!=number2) {
//            if (guess > number2) {
//                System.out.println("猜大了！");
//            } else {
//                System.out.println("猜小了！");
//            }
//            System.out.print("继续猜：");
//            guess = number1.nextInt();
//        }
//        System.out.println("猜对了！");

        Scanner number1 = new Scanner(System.in);
        int number2 = (int)(Math.random()*1000+1);
        System.out.println(number2);
        while (true) {
            System.out.print("猜吧：");
            int guess = number1.nextInt();
            if (guess > number2) {
                System.out.println("猜大了！");
            } else if (guess < number2) {
                System.out.println("猜小了！");
            } else {
                System.out.println("猜对了！");
                break;
            }
        }
    }
}
